
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>

<HEAD>
   <TITLE>eknelt_c</TITLE>
</HEAD>

<BODY style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<A name="TOP"></A>

<table style="text-align: left; margin-left: auto; margin-right: auto; width: 800px;"
 border="0" cellpadding="5" cellspacing="2">
  <tbody>
    <tr>
      <td style="background-color: rgb(153, 153, 153); vertical-align: middle; text-align: center;">
      <div align="right"> 
      <small><small><a href="index.html">Index Page</a></small></small>
      </div>
      <b>eknelt_c</b> </td>
    </tr>

    <tr>
      <td style="vertical-align: top;">

<small><div align="center">
<A HREF="index.html#A">A</A>&nbsp;
<A HREF="index.html#B">B</A>&nbsp;
<A HREF="index.html#C">C</A>&nbsp;
<A HREF="index.html#D">D</A>&nbsp;
<A HREF="index.html#E">E</A>&nbsp;
<A HREF="index.html#F">F</A>&nbsp;
<A HREF="index.html#G">G</A>&nbsp;
<A HREF="index.html#H">H</A>&nbsp;
<A HREF="index.html#I">I</A>&nbsp;
<A HREF="index.html#J">J</A>&nbsp;
<A HREF="index.html#K">K</A>&nbsp;
<A HREF="index.html#L">L</A>&nbsp;
<A HREF="index.html#M">M</A>&nbsp;
<A HREF="index.html#N">N</A>&nbsp;
<A HREF="index.html#O">O</A>&nbsp;
<A HREF="index.html#P">P</A>&nbsp;
<A HREF="index.html#Q">Q</A>&nbsp;
<A HREF="index.html#R">R</A>&nbsp;
<A HREF="index.html#S">S</A>&nbsp;
<A HREF="index.html#T">T</A>&nbsp;
<A HREF="index.html#U">U</A>&nbsp;
<A HREF="index.html#V">V</A>&nbsp;
<A HREF="index.html#W">W</A>&nbsp;
<A HREF="index.html#X">X</A>&nbsp;
</div></small>
       <br>
       <table style="text-align: left; width: 60%; margin-left: auto; margin-right: auto;"
       border="0" cellspacing="2" cellpadding="2">
        <tbody>
          <tr>
            <td style="width: 50%; text-align: center;">
            <small>
              <a href="#Procedure">Procedure<br></a>
              <a href="#Abstract">Abstract<br></a>
              <a href="#Required_Reading">Required_Reading<br></a>
              <a href="#Keywords">Keywords<br></a>
              <a href="#Brief_I/O">Brief_I/O<br></a>
              <a href="#Detailed_Input">Detailed_Input<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Detailed_Output">Detailed_Output<br></a>
              <a href="#Parameters">Parameters<br></a>
              <a href="#Exceptions">Exceptions<br></a>
              <a href="#Files">Files<br></a>
              <a href="#Particulars">Particulars<br></a>
              <a href="#Examples">Examples<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Restrictions">Restrictions<br></a>
              <a href="#Literature_References">Literature_References<br></a>
              <a href="#Author_and_Institution">Author_and_Institution<br></a>
              <a href="#Version">Version<br></a>
              <a href="#Index_Entries">Index_Entries<br></a>
             </small>
            </td>
          </tr>
        </tbody>
</table>

<h4><a name="Procedure">Procedure</a></h4>
<PRE>
   SpiceInt eknelt_c ( SpiceInt  selidx,
                       SpiceInt  row     ) 

</PRE>
<h4><a name="Abstract">Abstract</a></h4>
<PRE>
 
   Return the number of elements in a specified column entry in 
   the current row. 
 </PRE>
<h4><a name="Required_Reading">Required_Reading</a></h4>
<PRE>
 
   <a href="../req/ek.html">EK</a> 
 </PRE>
<h4><a name="Keywords">Keywords</a></h4>
<PRE>
 
   EK 
 

</PRE>
<h4><a name="Brief_I/O">Brief_I/O</a></h4>
<PRE>
 
   Variable  I/O  Description 
   --------  ---  -------------------------------------------------- 
   selidx     I   Index of parent column in SELECT clause. 
   row        I   Row containing element. 
   
   The function returns the number of elements in entry in current row. 
 </PRE>
<h4><a name="Detailed_Input">Detailed_Input</a></h4>
<PRE>
 
   selidx         is the SELECT clause index of the column to 
                  fetch from.  The range of selidx is 0 : (nsel-1)
                  inclusive, where nsel is the number of items in
                  the SELECT clause of the current query.
 
   row            is the index of the row containing the element. 
                  This number refers to a member of the set of rows 
                  matching a query.  row must be in the range 
 
                    0 : nmrows-1 
 
                  where nmrows is the matching row count returned 
                  by <a href="ekfind_c.html">ekfind_c</a>. 
 </PRE>
<h4><a name="Detailed_Output">Detailed_Output</a></h4>
<PRE>
 
   The function returns the number of elements in the column entry 
   belonging to the specified column in the current row. 
 
   Null entries in variable-size columns are considered to have size 1. 
 </PRE>
<h4><a name="Parameters">Parameters</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Exceptions">Exceptions</a></h4>
<PRE>
 
   1)  If this routine is called when no E-kernels have been loaded, 
       the error SPICE(NOLOADEDFILES) is signalled. 
 
   2)  If selidx is outside of the range established by the 
       last query passed to <a href="ekfind_c.html">ekfind_c</a>, the error SPICE(INVALIDINDEX) 
       will be signalled. 
 
   3)  If row is outside of the range established by the 
       last query passed to <a href="ekfind_c.html">ekfind_c</a>, the error SPICE(INVALIDINDEX) 
       will be signalled. 
 </PRE>
<h4><a name="Files">Files</a></h4>
<PRE>
 
   At least one E-kernel must be loaded before queries may be passed to
   the EK system via <a href="ekfind_c.html">ekfind_c</a>.
 </PRE>
<h4><a name="Particulars">Particulars</a></h4>
<PRE>
 
   This routine is meant to be used in conjunction with the EK 
   fetch entry points <a href="ekgc_c.html">ekgc_c</a>, <a href="ekgd_c.html">ekgd_c</a>, and <a href="ekgi_c.html">ekgi_c</a>.  This routine 
   allows the caller of those routines to determine appropriate 
   loop bounds to use to fetch each column entry in the current row. 
 </PRE>
<h4><a name="Examples">Examples</a></h4>
<PRE>
 
   1)  Suppose the EK table TAB contains the following columns: 
 
 
          Column name   Data Type   Size 
          -----------   ---------   ---- 
          IARRAY        INT         10 
          DARRAY        DP          VARIABLE 
          CARRAY        CHR         VARIABLE 
 
 
       Suppose the query 
 
          QUERY = &quot;SELECT IARRAY, DARRAY, CARRAY FROM TAB&quot; 
 
       is issued to <a href="ekfind_c.html">ekfind_c</a> via the call 
 
          <a href="ekfind_c.html">ekfind_c</a> ( query, MSGLEN, &amp;nmrows, &amp;error, errmsg );
 
       To fetch and dump column values from the rows that satisfy the 
       query, the loop below could be used.  Note that we don't check 
       the FOUND flags returned by the fetch routines since we know 
       in advance how many elements are contained in each column 
       entry we fetch. 
 
             #include &lt;stdio.h&gt;
             #include &quot;SpiceUsr.h&quot;
             
             #define ISIZE  10
                    .
                    .
                    .
             
              for ( row = 0;  row &lt; nmrows;  row++ )
             {
                printf ( &quot;\nROW  =  %d\n\n&quot;, row );
 
                /.
                Fetch values from column IARRAY in the current 
                row.  Since IARRAY was the first column selected, 
                the selection index SELIDX is set to 0. 
                ./
                selidx = 0;
                eltidx = 0;
                isnull = SPICEFALSE;
                
                while (  ( eltidx &lt; ISIZE ) &amp;&amp; ( !isnull )  )
                {
                    /.
                   If the column entry is null, we'll be kicked 
                   out of this loop after the first iteration. 
                   ./
                   
                   <a href="ekgi_c.html">ekgi_c</a> ( selidx,         row,      eltidx, 
                             ivals[eltidx],  &amp;isnull,  &amp;found );

                   eltidx++; 
                }
                
                printf ( &quot;\nCOLUMN  =  IARRAY\n\n&quot; );
 
                if ( isnull )
                {
                    printf ( &quot;&lt;Null&gt;\n&quot; );
                }
                else
                {
                    for ( i = 0;  i &lt; ISIZE;  i++ )
                   {
                       printf ( &quot;%d\n&quot;, ivals[i] );
                   }
                }
 
                /.
                Fetch values from column DARRAY in the current 
                row.  Since DARRAY contains variable-size array 
                elements, we call <b>eknelt_c</b> to determine how many 
                elements to fetch. 
                ./
 
                selidx = 1;
                eltidx = 0;
                nelt   = <b>eknelt_c</b> ( selidx, row );
                isnull = SPICEFALSE;
                
                while (  ( eltidx &lt; nelt ) &amp;&amp; ( !isnull )  )
                {
                    /.
                   If the column entry is null, we'll be kicked 
                   out of this loop after the first iteration. 
                   ./
                   
                   <a href="ekgd_c.html">ekgd_c</a> ( selidx,         row,      eltidx, 
                             dvals[eltidx],  &amp;isnull,  &amp;found   );

                   eltidx++; 
                }
                
                printf ( &quot;\nCOLUMN  =  DARRAY\n\n&quot; );
 
                if ( isnull )
                {
                    printf ( &quot;&lt;Null&gt;\n&quot; );
                }
                else
                {
                    for ( i = 0;  i &lt; nelt;  i++ )
                   {
                       printf ( &quot;%f\n&quot;, dvals[i] );
                   }
                }
 
                /.
                Fetch values from column CARRAY in the current row. 
                ./
 
                selidx = 2;
                eltidx = 0;
                nelt   = <b>eknelt_c</b> ( selidx, row );
                isnull = SPICEFALSE;
                
                while (  ( eltidx &lt; nelt ) &amp;&amp; ( !isnull )  )
                {
                    /.
                   If the column entry is null, we'll be kicked 
                   out of this loop after the first iteration. 
                   
                   CVLEN is the declared length of the strings in
                   the cvals array.
                   ./
                   
                   <a href="ekgc_c.html">ekgc_c</a> ( selidx,        row,     eltidx, CVLEN, 
                             cvals[eltidx], &amp;isnull, &amp;found         );

                   eltidx++; 
                }
 
                printf ( &quot;\nCOLUMN  =  CARRAY\n\n&quot; );
 
                if ( isnull )
                {
                    printf ( &quot;&lt;Null&gt;\n&quot; );
                }
                else
                {
                    for ( i = 0;  i &lt; nelt;  i++ )
                   {
                       printf ( &quot;%s\n&quot;, cvals[i] );
                   }
                }
 
             } 
 
 </PRE>
<h4><a name="Restrictions">Restrictions</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Literature_References">Literature_References</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Author_and_Institution">Author_and_Institution</a></h4>
<PRE>
 
   N.J. Bachman   (JPL) 
 </PRE>
<h4><a name="Version">Version</a></h4>
<PRE>
 
   -CSPICE Version 1.1.0, 23-JUL-2001 (NJB)
     
      Removed tab characters from source file.

   -CSPICE Version 1.0.0, 24-FEB-1999 (NJB)
</PRE>
<h4><a name="Index_Entries">Index_Entries</a></h4>
<PRE>
 
   return the number of elements in a column entry 
 </PRE>
<h4>Link to routine eknelt_c source file <a href='../../../src/cspice/eknelt_c.c'>eknelt_c.c</a> </h4>

      </td>
    </tr>
  </tbody>
</table>

   <pre>Wed Jun  9 13:05:22 2010</pre>

</body>
</html>

